


//
//  SHUserCenterCell.m
//  NEWHYSJ
//
//  Created by CYF on 2017/3/25.
//  Copyright © 2017年 SH. All rights reserved.
//

#import "SHUserCenterCell.h"

@interface SHUserCenterCell()
@property (nonatomic, strong) UILabel *titleLabel;//标题
@property (nonatomic, strong) UIView *line;//分割线
@property (nonatomic, strong) UIImageView *arrow;//右侧箭头

@end

@implementation SHUserCenterCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.titleLabel = [[UILabel alloc]init];
        self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
        self.titleLabel.font =  KSHSystemFont(14);
        [self.contentView addSubview:self.titleLabel];
        
        self.arrow = [[UIImageView alloc]init];
        self.arrow.image = [UIImage imageNamed:@"jmarrow"];
        [self.contentView addSubview:self.arrow ];

        self.line = [UIView new];
        self.line.backgroundColor = KLINECOLOR;
        [self.contentView addSubview:self.line];
    }
    
    return self;
}


- (void)layoutSubviews{

    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView).offset(__I6Width(15));
        make.centerY.equalTo(self.contentView);
    }];
    
    [self.arrow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(__I6Width(-15));
        make.centerY.equalTo(self.contentView);
    }];
    
    [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel.mas_left);
        make.right.equalTo(self.contentView);
        make.height.mas_offset(.5);
        make.bottom.equalTo(self.contentView);
    }];
    
    
}

//- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{
//    [super setHighlighted:highlighted animated:animated];
//    if (highlighted) {
//        self.backgroundColor = KCELLHIGHTLIGHTED;
//    }else{
//        self.backgroundColor = [UIColor whiteColor];
//
//    }
//
//}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated{
    [super setSelected:selected animated:animated];
   
    if (selected) {
        self.backgroundColor = KCELLHIGHTLIGHTED;
    }else{
        self.backgroundColor = [UIColor whiteColor];
        
    }


}

+ (instancetype)tableViewCellWithTableView:(UITableView *)tableView
{
    static NSString * cellIndentfile = @"SHUserCenterCell";
    SHUserCenterCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIndentfile];
    
    if (!cell) {
        cell = [[SHUserCenterCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndentfile];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
    
}


- (void)getTitleName:(NSString *)strName{
    
    self.titleLabel.text = strName;

}


@end




